<?php
$nbVert = $nbGris = $nbJaune = $nbOrange = $nbRouge = $statusRouge = $statusVert = $statusOrange = 0;
	
	$resultats = Evenement::getNombresCriticites();
	foreach($resultats as $s) {
		if($s['criticite_id'] == 1){
			$nbVert = $s['nbC'];
		}else if($s['criticite_id'] == 2){
			$nbGris = $s['nbC'];
		}else if($s['criticite_id'] == 3){
			$nbJaune = $s['nbC'];
		}else if($s['criticite_id'] == 4){
			$nbOrange = $s['nbC'];
		}else if($s['criticite_id'] == 5){
			$nbRouge = $s['nbC'];
		}	
	}	
	
	$statusUpDown = Evenement::getStatusMachineUpDown();
	foreach($statusUpDown as $sud){
		if($sud['criticite_id'] == 1){
			$statusVert = $sud['nbC'];
		}else{
			$statusRouge = $sud['nbC'];
		}
	}
	
	$statusWait = Evenement::getStatusEnAttente();
	foreach($statusWait as $sw){
		$statusOrange = $sw['nbC'];
	}
	
	$tabInfo = Evenement::getInformation();
	
?>	
    <div class="grid_5">
        <table class="notification">
            <caption>Statut service</caption>
            <thead>
                <tr>
                    <th>OK</th>
                    <th>Erreur</th>
                    <th>Warning</th>
                    <th>Problème</th>
                    <th>Critique</th>
                </tr>
            </thead>
            <tbody>
                <tr>
<?php 
    echo                '<td>
                            <a class="fancybox fancybox.ajax" href="statutService.php?id=1">
                                <p class="cercle_vert">'.$nbVert.'</p>
                            </a>
                        </td>
                        <td>
                            <a class="fancybox fancybox.ajax" href="statutService.php?id=2">
                                <p class="cercle_gris">'.$nbGris.'</p>
                            </a>
                        </td>
                        <td>
                            <a class="fancybox fancybox.ajax" href="statutService.php?id=3">
                                <p class="cercle_jaune">'.$nbJaune.'</p>
                            </a>
                        </td>
                        <td>
                            <a class="fancybox fancybox.ajax" href="statutService.php?id=4">
                                <p class="cercle_orange">'.$nbOrange.'</p>
                            </a>
                        </td>
                        <td>
                            <a class="fancybox fancybox.ajax" href="statutService.php?id=5">
                                <p class="cercle_rouge">'.$nbRouge.'</p>
                            </a>
                        </td>';
?>
                </tr>
            </tbody>
        </table>
    </div>

    <div class="grid_4">
        <table class="notification " style="margin-top: 12px;">
            <caption>Statut Machine</caption>
            <thead>
                <tr>
                  <th>Up</th>
                  <th>Down</th>
                  <th>Injoignable</th>
                  <th>En attente</th>
                </tr>
            </thead>
            <tbody>
                <tr>
					  <td><p class="cercle_vert"><?php echo $statusVert; ?></p></td>
                      <td><p class="cercle_rouge"><?php echo $statusRouge; ?></p></td>
                      <td><p class="cercle_jaune">#</p></td>
                      <td><p class="cercle_orange"><?php echo $statusOrange; ?></p></td>
                </tr>
            </tbody>
        </table>
    </div>

